package org.example.template.services;

import org.example.template.utils.DateUtil;
import org.example.template.utils.ExcelUtil;
import org.springframework.stereotype.Component;

import javax.servlet.http.HttpServletResponse;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.List;
@Component

public class ExportService {

    public void exportExcel(List<List<String>> idList, HttpServletResponse response) {

        List<String> titleList = Arrays.asList("序号", "PM1.0 浓度（大气环境下）单位：µg/m³", "PM2.5 浓度（大气环境下）单位：µg/m³", "PM10 浓度（大气环境下）单位：µg/m³","0.1 升空气中直径在 0.3um 以上颗粒物个数","0.1 升空气中直径在 0.5um 以上颗粒物个数","0.1 升空气中直径在 1.0um 以上颗粒物个数","0.1 升空气中直径在 2.5um 以上颗粒物个数","温度 单位：℃","湿度 单位：%","气压 单位：mbar","采集时间","");
        ExcelUtil.uploadExcelAboutUser(response, DateUtil.LocalDateTimeNow(LocalDateTime.now())+".xlsx", titleList, idList);
    }

}
